<?php
/* ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT); */
echo "<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>";
include("../conn.php");
include('pinyin.php');
$type=array('*');
mysql_query("SET NAMES UTF8");
// $express=mysql_fetch_app("express_delivery",$type,"pinyin=''","1");
$query=mysql_query("select * from express_delivery");
while ($row=mysql_fetch_assoc($query)) {
	$express[]=$row;
}
$num=count($express);
for ($i=0; $i < $num; $i++) { 
	$name = $express[$i]['name'];
	if (strstr($name, '快递')!=false) {
		$name = explode('快递',$name);
		$pin = $pinyin->getPinyin($name[0]);
	}elseif (strstr($name, '物流')!=false) {
		$name = explode('物流',$name);
		$pin = $pinyin->getPinyin($name[0]);
	}else{
		$pin = $pinyin->getPinyin($name);
	}
	$query=mysql_query("UPDATE express_delivery SET pinyin='".$pin."' where id=".$express[$i]['id']);
}


?>